<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>小程序开发文档</title>
		<script type="text/javascript" src="__JS__/vue.js"></script>
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<link rel="stylesheet" type="text/css" href="__CSS__/style.css">
		<style type="text/css">
			body{
				margin: 0;
				padding: 0;
			}
			.document-box{
				width: 100%;
				height: 100vh;
				display: flex;
				flex-direction: column;
			}
			.document-box_head{
				height: 70px;
				border-bottom: 1px solid #EAECEF;
			}
			.document-box_body{
				flex: 1;
				width: 100%;
				height: 100%;
				display: flex;
			}
			.document-box_body_left{
				width: 250px;
				height: 100%;
				border-right: 1px solid #EAECEF;
			}
			.document-box_body_left div{ margin-left:20px;padding:10px 0;cursor: pointer; }
			.document-box_body_content{
				flex: 1;
				width: 100%;
				height: 100%;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div class="document-box">
				<div class="document-box_head">小程序开发文档</div>
				<div class="document-box_body">
					<div class="document-box_body_left">
						<div v-for="(menu,index) in menuList">
							<div style="font-size: 15px;color:#959EA7;">{{menu.name}}</div>
							<div v-for="(item,index) in menu.list" @click="openDetail(item)">{{item.name}}</div>
						</div>
					</div>
					<div class="document-box_body_content">
						<!--  -->

      					<div v-html="contentObj.content" style="padding:10px;"></div>

      					<div style="padding:10px;" v-if="contentObj.tableAttr.length>0">
	      					<div>属性说明</div>
	      					<el-table :data="contentObj.tableAttr" style="width: 70%;">
								<el-table-column prop="attr" label="属性"></el-table-column>
								<el-table-column prop="type" label="类型"></el-table-column>
								<el-table-column prop="defaultValue" label="默认值"></el-table-column>
								<el-table-column prop="required" label="必填" width="50"></el-table-column>
								<el-table-column prop="desc" label="说明" width="220"></el-table-column>
							</el-table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			new Vue({
				el: '#app',
				data: {
					menuList:[
						{
							name:'视图容器',list:[
								{name:'view',content:'<p>view</p><h3>功能描述</h3><p>视图容器</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
								{name:'button',content:'<p>button</p><h3>功能描述</h3><p>按钮</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
								{name:'input',content:'<p>input</p><h3>功能描述</h3><p>输入框</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
								{name:'text',content:'<p>text</p><h3>功能描述</h3><p>文本。</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
								{name:'image',content:'<p>image</p><h3>功能描述</h3><p>图片。支持 JPG、PNG、SVG、WEBP、GIF 等格式</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
								{name:'dialog',content:'<p>dialog</p><h3>功能描述</h3><p>Dialog 对话框</p>',
									tableAttr:[
										{attr:'',type:'',defaultValue:'',required:0,desc:''},
									]
								},
							]
						},
						{
							name:'API',list:[
								{name:'navigateTo',content:'<p>wx.navigateTo</p><h3>功能描述</h3><p>保留当前页面，跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 wx.navigateBack 可以返回到原页面。小程序中页面栈最多十层。</p>',
									tableAttr:[
										{attr:'url',type:'string',defaultValue:'',required:'是',desc:'需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 ? 分隔，参数键与参数值用 = 相连，不同参数用 & 分隔；如 path?key=value&key2=value2'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'navigateBack',content:'<p>wx.navigateBack</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'navigateToMiniProgram',content:'<p>wx.navigateToMiniProgram</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'showToast',content:'<p>wx.showToast</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'setNavigationBarTitle',content:'<p>wx.setNavigationBarTitle</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'request',content:'<p>wx.request</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'setStorage',content:'<p>wx.setStorage</p><h3>功能描述</h3><p>将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理，否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB，所有数据存储上限为 10MB。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'getStorage',content:'<p>wx.getStorage</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'removeStorage',content:'<p>wx.removeStorage</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'clearStorage',content:'<p>wx.clearStorage</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'chooseMessageFile',content:'<p>wx.chooseMessageFile</p><h3>功能描述</h3><p>从客户端会话选择文件</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'setClipboardData',content:'<p>wx.setClipboardData</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
								{name:'getClipboardData',content:'<p>wx.getClipboardData</p><h3>功能描述</h3><p>关闭当前页面，返回上一页面或多级页面。</p>',
									tableAttr:[
										{attr:'delta',type:'string',defaultValue:'1',required:'是',desc:'返回的页面数，如果 delta 大于现有页面数，则返回到首页。'},
										{attr:'success',type:'function',defaultValue:'',required:'否',desc:'接口调用成功的回调函数'},
										{attr:'fail',type:'function',defaultValue:'',required:'否',desc:'接口调用失败的回调函数'},
										{attr:'complete',type:'function',defaultValue:'',required:'否',desc:'接口调用结束的回调函数（调用成功、失败都会执行）'},
									]
								},
							]
						}
					],
					contentObj:{
						content:'',
						tableAttr:[
							// {attr:'',type:'',defaultValue:'',required:0,desc:''},
						]
					}
				},
				mounted(){

				},
				methods: {
					openDetail(item){
						this.contentObj={
							content:item.content,
							tableAttr:item.tableAttr
						}
					}
				}
			});

		</script>
	</body>
</html>